package com.tedu.bill.demo8;

/**
 * Author：毕龙
 * Date: 2024/4/17 10:54
 */
public class Teacher {
    //成员变量会有默认的值
    String name ;
    int age;
    String course ;
    //默认无参构造
    //构造方法跟类名相同 没有返回值类型
    //构造方法用来创建对象初始化实例变量
    public Teacher(){
        System.out.println("执行无参的构造方法");
    }

    public Teacher(String n){
        name = n;
    }

    public Teacher(String n,int a,String c){
        name = n;
        age = a;
        course = c;
    }

    public void print(){
        //局部变量
        int a ;
        //Variable 'a' might not have been initialized
        //System.out.println(a);
        System.out.println(name);
    }
}
